Skip to contentSkip to conversation

Change in openvpn[release/2.6]: multi: Warn about failing read in multi_process_file_closed()

Openvpn-devel In review cron2 (Code Review) 2 participants 7 messages Dec 16, 2025 – Dec 29, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1765869635000.I950863eeba67b8c006c794245a1a08752cd79fb0@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email

to review the following change.

Change subject: multi: Warn about failing read in multi_process_file_closed()
......................................................................

multi: Warn about failing read in multi_process_file_closed()

Handle failure explicitly instead of the implicit
handling by "while (buffer_i < r)".

Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198

Github: openvpn-private-issues#101

Change-Id I950863eeba67b8c006c794245a1a08752cd79fb0

---
M src/openvpn/multi.c

1 file changed, 7 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1444/1

src/openvpn/multi.c +7 -2
index 94e623b..69497a6 100644
@@ -2830,8 +2830,13 @@
 multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags)
 {
     char buffer[INOTIFY_EVENT_BUFFER_SIZE];
-    size_t buffer_i = 0;
-    int r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    ssize_t buffer_i = 0;
+    ssize_t r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    if (r < 0)
+    {
+        msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");
+        return;
+    }
 
     while (buffer_i < r)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

ordex has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email )

Change subject: multi: Warn about failing read in multi_process_file_closed()
......................................................................

Patch Set 1:

(1 comment)

File src/openvpn/multi.c:

http://gerrit.openvpn.net/c/openvpn/+/1444/comment/e3f8c5d2_2d609a7d?usp=email :
PS1, Line 2837: msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");
FTR I like having a message on failure, but the code we just applied to 2.7 doesn't have any. Should we be consistent?

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-CC: ordex <[email protected]...>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Tue, 16 Dec 2025 10:24:17 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No

#3 lore raw
In reply to a message not in the archive

Attention is currently required from: cron2, plaisthos.

ordex has posted comments on this change by cron2. ( http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email )

Change subject: multi: Warn about failing read in multi_process_file_closed()
......................................................................

Patch Set 1: Code-Review+2

(1 comment)

File src/openvpn/multi.c:

http://gerrit.openvpn.net/c/openvpn/+/1444/comment/3f440efd_25872d56?usp=email :
PS1, Line 2837: msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");

Quoted 1 line

FTR I like having a message on failure, but the code we just applied to 2.7 doesn't have any. […]

Done

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 1
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: cron2 <[email protected]...>
Gerrit-Comment-Date: Tue, 16 Dec 2025 10:25:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: ordex <[email protected]...>

#4 lore raw

PATCH 1/1 multi: Warn about failing read in multi_process_file_closed()

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Handle failure explicitly instead of the implicit
handling by "while (buffer_i < r)".

Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198

Github: openvpn-private-issues#101

Change-Id I950863eeba67b8c006c794245a1a08752cd79fb0

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to release/2.6.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Antonio Quartulli <[email protected]...>

src/openvpn/multi.c +7 -2
index 94e623b..69497a6 100644
@@ -2830,8 +2830,13 @@
 multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags)
 {
     char buffer[INOTIFY_EVENT_BUFFER_SIZE];
-    size_t buffer_i = 0;
-    int r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    ssize_t buffer_i = 0;
+    ssize_t r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    if (r < 0)
+    {
+        msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");
+        return;
+    }
 
     while (buffer_i < r)
     {
#5 lore raw

[Openvpn-devel] [PATCH applied] Re: multi: Warn about failing read in multi_process_file_closed()

Backport of the relevant pieces of commit 18d1b1fe008 and 5e5ead5ba01, and since this is a bugfix (missing/broken error handling branch), relevant to release/2.6. Thanks :-)

Your patch has been applied to the release/2.6 branch.

commit d8a30a5bf20eb3f57c8ccd66525b719d743df6fa

Author: Frank Lichtenheld
Date:   Tue Dec 16 12:15:39 2025 +0100
     multi: Warn about failing read in multi_process_file_closed()

     Signed-off-by: Gert Doering <[email protected]...>
     Acked-by: Antonio Quartulli <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35113.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#6 lore raw
In reply to a message not in the archive

Hello ordex, plaisthos,

I'd like you to reexamine a change. Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email

to look at the new patch set (#2).

The following approvals got outdated and were removed:
Code-Review+2 by ordex

Change subject: multi: Warn about failing read in multi_process_file_closed()
......................................................................

multi: Warn about failing read in multi_process_file_closed()

Handle failure explicitly instead of the implicit
handling by "while (buffer_i < r)".

Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198

Github: openvpn-private-issues#101

Change-Id I950863eeba67b8c006c794245a1a08752cd79fb0

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35113.html

---
M src/openvpn/multi.c

1 file changed, 7 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/44/1444/2

src/openvpn/multi.c +7 -2
index 94e623b..69497a6 100644
@@ -2830,8 +2830,13 @@
 multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags)
 {
     char buffer[INOTIFY_EVENT_BUFFER_SIZE];
-    size_t buffer_i = 0;
-    int r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    ssize_t buffer_i = 0;
+    ssize_t r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    if (r < 0)
+    {
+        msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");
+        return;
+    }
 
     while (buffer_i < r)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#7 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email )

Change subject: multi: Warn about failing read in multi_process_file_closed()
......................................................................

multi: Warn about failing read in multi_process_file_closed()

Handle failure explicitly instead of the implicit
handling by "while (buffer_i < r)".

Backport of 18d1b1fe008a4bbfd5a56ca7bb59f6f8cb58114a and the relevant type fix of 5e5ead5ba019fc2a8266f77a7d840b30fd545198

Github: openvpn-private-issues#101

Change-Id I950863eeba67b8c006c794245a1a08752cd79fb0

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1444
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35113.html

---
M src/openvpn/multi.c

1 file changed, 7 insertions(+), 2 deletions(-)
src/openvpn/multi.c +7 -2
index 94e623b..69497a6 100644
@@ -2830,8 +2830,13 @@
 multi_process_file_closed(struct multi_context *m, const unsigned int mpp_flags)
 {
     char buffer[INOTIFY_EVENT_BUFFER_SIZE];
-    size_t buffer_i = 0;
-    int r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    ssize_t buffer_i = 0;
+    ssize_t r = read(m->top.c2.inotify_fd, buffer, INOTIFY_EVENT_BUFFER_SIZE);
+    if (r < 0)
+    {
+        msg(M_WARN | M_ERRNO, "MULTI: multi_process_file_closed error");
+        return;
+    }
 
     while (buffer_i < r)
     {

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1444?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: release/2.6
Gerrit-Change-Id: I950863eeba67b8c006c794245a1a08752cd79fb0
Gerrit-Change-Number: 1444
Gerrit-PatchSet: 2
Gerrit-Owner: cron2 <[email protected]...>
Gerrit-Reviewer: ordex <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: flichtenheld <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>